/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.LoadModel.impl;

import EA_Model.IEC61970.Domain.AbsoluteDateTime;

import EA_Model.IEC61970.LoadModel.LoadModelPackage;
import EA_Model.IEC61970.LoadModel.Season;
import EA_Model.IEC61970.LoadModel.SeasonName;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Season</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.LoadModel.impl.SeasonImpl#getEndDate <em>End Date</em>}</li>
 *   <li>{@link EA_Model.IEC61970.LoadModel.impl.SeasonImpl#getName <em>Name</em>}</li>
 *   <li>{@link EA_Model.IEC61970.LoadModel.impl.SeasonImpl#getStartDate <em>Start Date</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SeasonImpl extends EObjectImpl implements Season {
	/**
	 * The cached value of the '{@link #getEndDate() <em>End Date</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEndDate()
	 * @generated
	 * @ordered
	 */
	protected AbsoluteDateTime endDate;

	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final SeasonName NAME_EDEFAULT = SeasonName.WINTER;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected SeasonName name = NAME_EDEFAULT;

	/**
	 * The cached value of the '{@link #getStartDate() <em>Start Date</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getStartDate()
	 * @generated
	 * @ordered
	 */
	protected AbsoluteDateTime startDate;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SeasonImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return LoadModelPackage.Literals.SEASON;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime getEndDate() {
		if (endDate != null && endDate.eIsProxy()) {
			InternalEObject oldEndDate = (InternalEObject)endDate;
			endDate = (AbsoluteDateTime)eResolveProxy(oldEndDate);
			if (endDate != oldEndDate) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, LoadModelPackage.SEASON__END_DATE, oldEndDate, endDate));
			}
		}
		return endDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime basicGetEndDate() {
		return endDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEndDate(AbsoluteDateTime newEndDate) {
		AbsoluteDateTime oldEndDate = endDate;
		endDate = newEndDate;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, LoadModelPackage.SEASON__END_DATE, oldEndDate, endDate));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SeasonName getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(SeasonName newName) {
		SeasonName oldName = name;
		name = newName == null ? NAME_EDEFAULT : newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, LoadModelPackage.SEASON__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime getStartDate() {
		if (startDate != null && startDate.eIsProxy()) {
			InternalEObject oldStartDate = (InternalEObject)startDate;
			startDate = (AbsoluteDateTime)eResolveProxy(oldStartDate);
			if (startDate != oldStartDate) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, LoadModelPackage.SEASON__START_DATE, oldStartDate, startDate));
			}
		}
		return startDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime basicGetStartDate() {
		return startDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setStartDate(AbsoluteDateTime newStartDate) {
		AbsoluteDateTime oldStartDate = startDate;
		startDate = newStartDate;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, LoadModelPackage.SEASON__START_DATE, oldStartDate, startDate));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case LoadModelPackage.SEASON__END_DATE:
				if (resolve) return getEndDate();
				return basicGetEndDate();
			case LoadModelPackage.SEASON__NAME:
				return getName();
			case LoadModelPackage.SEASON__START_DATE:
				if (resolve) return getStartDate();
				return basicGetStartDate();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case LoadModelPackage.SEASON__END_DATE:
				setEndDate((AbsoluteDateTime)newValue);
				return;
			case LoadModelPackage.SEASON__NAME:
				setName((SeasonName)newValue);
				return;
			case LoadModelPackage.SEASON__START_DATE:
				setStartDate((AbsoluteDateTime)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case LoadModelPackage.SEASON__END_DATE:
				setEndDate((AbsoluteDateTime)null);
				return;
			case LoadModelPackage.SEASON__NAME:
				setName(NAME_EDEFAULT);
				return;
			case LoadModelPackage.SEASON__START_DATE:
				setStartDate((AbsoluteDateTime)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case LoadModelPackage.SEASON__END_DATE:
				return endDate != null;
			case LoadModelPackage.SEASON__NAME:
				return name != NAME_EDEFAULT;
			case LoadModelPackage.SEASON__START_DATE:
				return startDate != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(')');
		return result.toString();
	}

} //SeasonImpl
